from logger.logger import Logger
from config.config import config
import os
import time


def setup_custom_logger(path):
    print("log file path: %s" % os.path.abspath(path))
    dirName = os.path.dirname(path)
    if not os.path.exists(dirName):
        os.makedirs(dirName)
    log = Logger(os.path.abspath(path), level='debug')
    return log.logger


projectPath = config["project_path"]
logDirPath = config["logger"]["log_dir_path"]
logFilePath = r'%s/%s/%s_%s.log' % (projectPath, logDirPath, "log", time.strftime("%Y-%m-%d_%H-%M-%S", time.localtime()))
logger = setup_custom_logger(logFilePath)


def get_logger():
    return logger
